GBML manual / Audio

sound_speed

Sets the playback rate (1 = normal, 2 = double speed, 0.5 = half speed...) of s’s own currently-playing instance - same "no-op if not tracked" rule as sound_pan.

Syntax

sound_speed(s, speed)

Arguments

NameType
ssound
speedreal

Returns

Nothing.

Description

Sets the playback rate (1 = normal, 2 = double speed, 0.5 = half speed...) of s's own currently-playing instance - same "no-op if not currently tracked" rule as sound_pan, and the same "call it right after sound_play in the same event" answer for setting it at play time.

This is both speed and pitch at once - the one knob a one-shot sound effect has. Changing how fast it plays changes how high or low it sounds too; there is no way to change one without the other for a sound effect on this hardware. Compare music_pitch/music_tempo, which genuinely are independent knobs for music.

Example

sound_play(snd_doc_beep, 1);
sound_speed(snd_doc_beep, 1.5);

Plays the beep 50% faster and a fifth or so higher in pitch, together - a cheap way to give a repeated sound effect (a footstep, a pickup) a little variety by picking a random speed each time instead of always sounding identical.

On the GBA

This is BOTH speed and pitch at once - the one knob a one-shot sound effect has. Changing how fast it plays changes how high or low it sounds too; there is no way to change one without the other for a sound effect on this hardware (compare music_pitch/music_tempo, which genuinely are independent for music).

See also: sound_pansound_playmusic_pitch